﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;

namespace Meebey.SmartIrc4net
{
    
    class CaseInsensitiveStringCollection : StringCollection
    {
        public new bool Contains(string value)
        {
            value = value.ToUpper();
            foreach (string s in this)
            {
                if (s.ToUpper() == value)
                    return true;
            }
            return false;
        }

        public new int Add(string value)
        {
            if(!Contains(value))
                return base.Add(value);
            return -1;
        }

        public new void Remove(string value)
        {
            value = value.ToUpper();
            foreach (string s in this)
            {
                if (s.ToUpper() == value)
                {
                    base.Remove(s);
                    return;
                }
            }
        }

    }
}
